﻿using System;
using System.Collections.Generic;
using System.Linq;
using YJKCopyModel.LastFastModeling;

namespace YJKCopyModel.FastModelConvert
{
	[Grouper(GrouperName = "FastModeConvert")]
	public class FastModelConvertGrouper : IDataGrouper
	{
		public List<RevitModelRequest> GroupData(InputRequest inputRequest)
		{
			List<RevitModelRequest> result;
			try
			{
				FastModelConvertInputRequest fastModelConvertInputRequest = inputRequest as FastModelConvertInputRequest;
				bool flag = fastModelConvertInputRequest == null;
				if (flag)
				{
					result = new List<RevitModelRequest>();
				}
				else
				{
					result = this.GetDataForCommonEquip(fastModelConvertInputRequest);
				}
			}
			catch (Exception ex)
			{
				result = new List<RevitModelRequest>();
			}
			return result;
		}

		public List<RevitModelRequest> GetDataForCommonEquip(FastModelConvertInputRequest inputRequest)
		{
			List<RevitModelRequest> list = new List<RevitModelRequest>();
			List<PointPosBlockInfo> list2 = inputRequest.SelectDataMap["SelectedBlocks"].Cast<PointPosBlockInfo>().ToList<PointPosBlockInfo>();
			bool flag = list2 == null || list2.Count <= 0;
			List<RevitModelRequest> result;
			if (flag)
			{
				result = new List<RevitModelRequest>();
			}
			else
			{
				foreach (PointPosBlockInfo pointPosBlockInfo in list2)
				{
					bool flag2 = pointPosBlockInfo == null;
					if (!flag2)
					{
						list.Add(new FastModelConvertRevitModelRequest
						{
							Block = pointPosBlockInfo,
							PlaceFs = inputRequest.PlaceFs,
							ViewParas = inputRequest.ViewParas
						});
					}
				}
				result = list;
			}
			return result;
		}
	}
}
